package model;

import java.io.Serializable;
import model.game.Player;
import model.game.World;

public class User implements Serializable{
    private int id;
    private String name;
    private Player player;

    public User(String name, World world, Server server){
        this.name = name;
        if (!server.getWorld().getMap().playerExists(name)){
            player = new Player(name);
            server.getWorld().getMap().respawnPlayer(player);
            server.sendToConsole("Criado novo player: "+ player.getName() + " - Life: " + player.getLife()); 
        }else{
            player = server.getWorld().getMap().findPlayer(name);
            server.sendToConsole("Jogador recuperado...");                      
        }
    }
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }
}
